//
// Created by wze-zero on 2024/8/17 017.
//
#include <iostream>

using namespace std;

int main() {
    int num1, num2;
    cin >> num1 >> num2;
    cout << num1 % num2 << endl;
    return 0;
}